package com.show.mytest;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test01_Runnable {
    public static void main(String[] args) {
        // 创建自定义Runnable对象
        MyRunnable2 r = new MyRunnable2();
        // 创建线程池,指定线程数量
        ExecutorService service = Executors.newFixedThreadPool(3);
        // 提交三个线程执行任务
        service.submit(r);
        service.submit(r);
        service.submit(r);
        // 关闭线程池
        service.shutdown();
    }
}
